/*============================================================================*/
/*                          The Freescale Cup                                 */
/*============================================================================*/
/*                        OBJECT SPECIFICATION                                */
/*============================================================================*
* C Source:         initapp.c
* %version:         1 %
* %created_by:      Continental %
* %date_created:     %
*=============================================================================*/
/* DESCRIPTION :  Initialize tasks                                            */
/*============================================================================*/
/* FUNCTION COMMENT : Add here your initialization tasks.                     */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/*                               OBJECT HISTORY                               */
/*============================================================================*/
/*  REVISION |   DATE      |                               |      AUTHOR      */
/*----------------------------------------------------------------------------*/
/*  1.0      | 22/08/2011  |  Revision                     | Continental      */
/*                                                                            */
/*============================================================================*/

/* Includes */
/* ------------------- */
/* Common declarations */
/* ------------------- */
#include "initapp.h"

/*       SW API    */
/* --------------- */
#include "HALInputs.h"
#include "HALOutputs.h"


/**************************************************************
 *  Name                 : initapp_task_InitHW
 *  Description          : TASK_INIT_HW
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_InitHW(void)
 {
	/* Input Configuration */
	Init_LightingSelector_hardware				();
	Init_AmbientLightSelector_hardware			();
	Init_LeftTurnButton_hardware				();
	Init_RightTurnButton_hardware				();
	Init_SteeringWheel_hardware					();
	Init_StopButton_hardware					();
	Init_EmergencyLightsButton_hardware			();
	Init_ReverseSwitch_hardware					();
	Init_IgnitionSwitch_hardware				();
	Init_HeadlightsBeamModeBtn_hardware			();
	Init_HeadlightsContinuousModeBtn_hardware	();
	
	/* Output Configuration */
	Init_HighBeamLights_hardware 			();
	Init_LowBeamLights_hardware 			();
	Init_RightFrontParkingLights_hardware 	();
	Init_LeftFrontParkingLights_hardware 	();
	Init_RightRearParkingLights_hardware 	();
	Init_LeftRearParkingLights_hardware 	();
	Init_ReverseLights_hardware 			();
	Init_RightFrontTurnSignal_hardware 		();
	Init_LeftFrontTurnSignal_hardware 		();
	Init_RightRearTurnSignal_hardware 		();
	Init_LeftRearTurnSignal_hardware 		();
	Init_RightStopLights_hardware 			();
	Init_LeftStopLights_hardware 			();
	Init_RightEmergencyLigths_hardware 		();
	Init_LeftEmergencyLights_hardware 		();
 }
 
 /**************************************************************
 *  Name                 : initapp_task_Lighting
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_Lighting(void)
 {
	Set_LowBeamLights_State (INVALID);
	
	/*Set_RightFrontParkingLights_State (INVALID);
	Set_LeftFrontParkingLights_State  (INVALID);*/
	Set_RightRearParkingLights_State  (INVALID);
	Set_LeftRearParkingLights_State   (INVALID);
 }
 
 /**************************************************************
 *  Name                 : initapp_task_Road
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_Road(void)
 {
	Set_HighBeamLights_State (INVALID);
 }
 
 /**************************************************************
 *  Name                 : initapp_task_Emergency
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_Emergency(void)
 {
	Set_RightEmergencyLigths_State 	(INVALID);
    Set_LeftEmergencyLights_State 	(INVALID);
	
	/*Set_RightFrontParkingLights_State (INVALID);
	Set_LeftFrontParkingLights_State  (INVALID);*/
	Set_RightRearParkingLights_State  (INVALID);
	Set_LeftRearParkingLights_State   (INVALID);
 }
 
 /**************************************************************
 *  Name                 : initapp_task_Reverse
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_Reverse(void)
 {
    Set_ReverseLights_State (INVALID);
 }
 
 /**************************************************************
 *  Name                 : initapp_task_Stop
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_Stop(void)
 {
	/* right group (turn/stop/emer) */
	Set_RightRearTurnSignal_State 		(INVALID);
	Set_RightStopLights_State 			(INVALID);
	Set_RightEmergencyLigths_State 		(INVALID);
	
	/* left group (turn/stop/emer) */
	Set_LeftRearTurnSignal_State 		(INVALID);
	Set_LeftStopLights_State 			(INVALID);
	Set_LeftEmergencyLights_State 		(INVALID);
 }
 
 /**************************************************************
 *  Name                 : initapp_task_FrontSteering
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_FrontSteering(void)
 {
	/*Set_RightFrontParkingLights_State (INVALID);
	Set_LeftFrontParkingLights_State  (INVALID);*/
 }
 
  /**************************************************************
 *  Name                 : initapp_task_RearSteering
 *  Description          :
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  no
 **************************************************************/
 void initapp_task_RearSteering(void)
 {
	/* right group (turn/stop/emer) */
	Set_RightRearTurnSignal_State 		(INVALID);
	Set_RightStopLights_State 			(INVALID);
	Set_RightEmergencyLigths_State 		(INVALID);
	
	/* left group (turn/stop/emer) */
	Set_LeftRearTurnSignal_State 		(INVALID);
	Set_LeftStopLights_State 			(INVALID);
	Set_LeftEmergencyLights_State 		(INVALID);
 }